<template>
	<view class="sksettings">
		<!-- #ifdef APP-PLUS -->
		<Hearder :name="'设置收款方式'"></Hearder>
		<!-- #endif -->
		<view class="content">
			<view class="every bgbottom" v-for="(item,index) in list" :key="index">
				<view class="zfbname">
					<view class="zfb_left">
						<view v-if="item.type!=3">{{item.type_name}}姓名</view>
						<view v-if="item.type==3">{{item.type_name}}</view>
						<view v-if="item.user_name==''">未设置</view>
						<view v-else>{{item.user_name}}</view>
					</view>
					<u-transition :show="show">
						<view class="zfbname_right">
							<image src="../../static/images/wx.png" v-if="item.type==1"></image>
							<image src="../../static/images/zfb.png" v-if="item.type==2"></image>
							<image src="../../static/images/yhk.png" v-if="item.type==3"></image>
						</view>
					</u-transition>
				</view>
				<view class="zfbzh">
					<view class="zfb_left">
						<view>{{item.type_name}}账号</view>
						<view v-if="item.card=='' && item.type==1">未设置微信账号</view>
						<view v-if="item.card=='' && item.type==2">未设置支付宝账号</view>
						<view v-if="item.card=='' && item.type==3">未设置银行卡账号</view>
						<view v-if="item.card!=''">{{item.card}}</view>
					</view>
					<view class="zfbzh_right" v-if="item.user_name==''" @click="toPage('allpayment?type='+index+'&withdrawal_setting_id='+item.withdrawal_setting_id)">设置</view>
					<view class="zfbzh_right" v-if="item.user_name!=''" @click="toPage('allpayment?type='+index+'&withdrawal_setting_id='+item.withdrawal_setting_id)">编辑</view>
				</view>
				<view class="zezhao" @click="historyback(index,item.user_name)"></view>
			</view>
		</view>
		<shopro-login-modal :showLogin="showLogin" @loginhidden="loginhidden"></shopro-login-modal>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				show:true,
				showLogin:false,
				list:[]
			}
		},
		onShow() {
			this.request('/member/getPay').then(res => {
				if(res.data.code==-500){
					this.showLogin=true
				}
				if(res.data.code==1){
					this.list = res.data.data
				}	
			})
		},
		methods:{
			relieve(withdraw_setting_id){
				this.request('/member/withdraw/unbind',{withdraw_setting_id:withdraw_setting_id}).then(res => {
					if(res.data.code==1){
						this.$tip(res.data.msg)
						this.getinit()
					}else{
						this.$tip(res.data.msg)
					}
				})
			},
			historyback(index,user_name){
				if(user_name==''){
					this.$tip("请先设置收款方式")
				}else{
					setTimeout(()=>{
						uni.redirectTo({
							url:'balance?index='+index
						})
					},500)
				}
			},
			changetype(t){
				this.type=t
				this.getinit()
			},
			loginhidden(data){
				this.showLogin=data
			},
			toPage(route){
				uni.navigateTo({
				    url: route
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.sksettings{
		.content{
			.every{
				position: relative;
				padding: 30rpx 4%;
				.zfbname,
				.zfbzh{
					display: flex;
					justify-content: space-between;
				}
				.zfb_left{
					view{
						font-size: 28rpx;
						&:first-of-type{
							margin-bottom: 20rpx;
							font-size: 24rpx;
							color: #999;
						}
					}
				}
				.zfbname_right{
					margin-right: 18rpx;
					image{
						width: 94rpx;
						height: 94rpx;
					}
				}
				.zfbzh{
					margin-top: 40rpx;
					align-items: flex-end;
					.zfbzh_right{
						width: 140rpx;
						height: 50rpx;
						border-radius: 50rpx;
						border: 2rpx solid $uni-item-color;
						text-align: center;
						line-height: 50rpx;
						font-size: 26rpx;
						color: $uni-item-color;
					}
				}
			}
			.zezhao{
				position: absolute;
				width: 70%;
				height: 100%;
				top: 0;
				left: 0;
			}
		}
	}
</style>
